#include <Length.h>

const unsigned int inchToBase = 1;
const unsigned int feetToBase = 12 * inchToBase;
const unsigned int yardToBase = 3 * feetToBase;
const unsigned int mileToBase = 1760 * yardToBase;

const Unit inch(inchToBase, "inch");
const Unit feet(feetToBase, "feet");
const Unit yard(yardToBase, "yard");
const Unit mile(mileToBase, "mile");

const Unit lengthUnitArray[] = {inch, feet, yard, mile};

Length::Length(const unsigned int amount, const Unit unit) :
		Measure(amount, unit)
{
}

bool Length::operator == (const Length& length) const
{
	return (this->toBase() == length.toBase());
}

Length Length::operator + (const Length& length) const
{
    return Length(this->toBase() + length.toBase(), inch);
}

void Length::formatPrint()
{
	Measure::formatPrint(&lengthUnitArray[0], sizeof(lengthUnitArray)/sizeof(Unit));
}

